#include <util.h>
#include <lsort.h>
#include <qsort.h>

int main(int argc, char *argv[])
{
    int a[ARRAY_LEN], b[ARRAY_LEN], i;
    /* bid-endian or little-endian test
    int x = 0x12345678;
    printf("%#x:%#x:%#x:%#x\n", *(unsigned char *)&x,*((unsigned char *)&x+1),
            *((unsigned char *)&x+2), *((unsigned char *)&x+3));
            */

    srand(time(NULL));
    for (i = 0; i < ARRAY_LEN; i++)
    {
        b[i] = 0;
        a[i] = rand() % MY_RAND_MAX;
    }

    print_a(a, ARRAY_LEN, NULL);
    count_sort(a, b, ARRAY_LEN, MY_RAND_MAX-1);
    fprintf(stdout, "count_sort:\n");
    print_a(b, ARRAY_LEN, NULL);
    quicksort(a, 0, ARRAY_LEN-1);
    fprintf(stdout, "quicksort:\n");
    print_a(a, ARRAY_LEN, NULL);

    return 0;
}
